package com.atguigu.common.valid;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;

/**
 * 自定义校验器的步骤
 * 1) 编写校验注解 ListValid
 * 2) 编写校验器 ListValidConstraintValidator
 * 3) 绑定校验器和校验注解之间的关系  @Constraint(validatedBy = {ListValidConstraintValidator.class})
 */
@Documented
@Constraint(
        validatedBy = {ListValidConstraintValidator.class}
)
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.TYPE_USE})
@Retention(RetentionPolicy.RUNTIME)
public @interface ListValid {
    String message() default "{com.atguigu.common.valid.ListValid.message}";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

    int[] vals() default {};
}
